home *** CD-ROM | disk | FTP | other *** search
- Path: xanth!cs.odu.edu!Amiga-Request
- From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
- Newsgroups: comp.sources.amiga
- Subject: v90i043: BBSindex 1.0 - file database utility for BBS-PC!, Part03/03
- Message-ID: <11250@xanth.cs.odu.edu>
- Date: 2 Feb 90 19:57:16 GMT
- Sender: tadguy@cs.odu.edu
- Reply-To: Eddy Carroll <ECARROLL%vax1.tcd.ie@CUNYVM.CUNY.EDU>
- Lines: 851
- Approved: tadguy@cs.odu.edu (Tad Guy)
- X-Mail-Submissions-To: Amiga@cs.odu.edu
-
- Submitted-by: Eddy Carroll <ECARROLL%vax1.tcd.ie@CUNYVM.CUNY.EDU>
- Posting-number: Volume 90, Issue 043
- Archive-name: util/bbsindex-1.0/part03
-
- #!/bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 3 (of 3)."
- # Contents: bbsindex.doc
- # Wrapped by tadguy@xanth on Fri Feb 2 14:54:43 1990
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'bbsindex.doc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'bbsindex.doc'\"
- else
- echo shar: Extracting \"'bbsindex.doc'\" \(36686 characters\)
- sed "s/^X//" >'bbsindex.doc' <<'END_OF_FILE'
- X
- X BBSINDEX -- generates BBS-PC! file listings
- X
- X (C) Copyright Eddy Carroll, December 1989
- X
- X
- XINTRODUCTION
- X
- X BBSindex is a utility for use with the BBS-PC! bulletin board package.
- X It reads in the UDHEAD.DAT file database and allows you to list its
- X contents in a wide variety of ways. It has its own script language
- X which allows great control over the output produced.
- X
- X BBSindex can perform the following operations on the file database:
- X
- X - Sort the files into order by Name, Size, Date or any other field
- X - Select files matching specified criteria
- X - Print file lists, using a user specified format string
- X - Determine which files are currently present in the download dirs
- X - List files that are in the download dirs but not the database
- X
- X The script language allows you to combine these to perform tasks such
- X as the following:
- X
- X - Produce file lists similar to those produced with the BBS-PC!
- X catalogue command, but sorted into any order. For example, BBS-PC!
- X won't let you list all the files in a given directory sorted into
- X alphabetical order. BBSindex will. With BBSindex, such lists can
- X be generated automatically and regularly (e.g. daily), and made
- X available to the BBS users through a menu item. The same file can
- X be locally uploaded into the file section for users to download.
- X
- X - Produce a list of files on and off line, just like BBS-PC!'s ChkFile
- X utility. In addition, BBSindex can spot files which are online but
- X which have a filesize different to that in the file catalogue. Such
- X files are most likely corrupt.
- X
- X - Build AmigaDOS batch files to perform maintenance tasks, such as
- X moving all the files in a particular section from whatever disk
- X directories they are currently located in into a new directory, or
- X moving all the files which are in the BBS-PC! download directories
- X but are NOT in the file catalogue to somewhere else.
- X
- X Without further ado, let's move on to the program itself.
- X
- X
- XUSAGE
- X
- X The command template for bbsindex looks like this:
- X
- X bbsindex {options} scriptfile ...
- X
- X You must always specify at least one script file to be executed. If
- X BBSindex can't find the file you asked for, it will look for a
- X similarly named one with a .SCR suffix. If you specify several files,
- X BBSindex will execute them in sequence as if they were a single
- X continuous file. Any settings, open files etc. are maintained across
- X multiple script files. This can be both a help and a hinderance; if
- X you are careful not to make scripts to reliant on default settings,
- X you shouldn't have any problems.
- X
- X BBSindex allows you to change some of its default settings via command
- X line options. These can all be changed via script commands as well,
- X but it is sometimes convenient to be able to alter them independently of
- X the script. The available options are listed below. Note that for those
- X options that take a parameter, there must be a space between the option
- X letter and the parameter.
- X
- X -c filename
- X This option allows you to specify the name of the configuration
- X file BBSindex should read to locate BBS-PC!'s download directories.
- X By default, it looks for the file CFGINFO.DAT in the current
- X directory. If you are running BBSindex from a directory other than
- X BBS-PC's home directory, you may need to use this option.
- X
- X -d filename
- X This option lets you specify the name of the file in which BBS-PC!
- X stores all the information about its file database. By default,
- X BBSindex will look for the file UDHEAD.DAT in the current directory.
- X
- X -f "string"
- X This option lets you change the format string used when outputting
- X file listings. See the discussion of the FORMAT command for a full
- X explanation of what to use here.
- X
- X -h
- X This prints out a brief help screen listing the command line
- X options.
- X
- X -n
- X This option stops BBSindex from putting up AmigaDOS requesters
- X (such as "Please insert volume FOO: in any drive"). It can be
- X useful if some of the BBS download directories are not currently
- X mounted, and BBSindex tries to access them.
- X
- X -s
- X This option causes any OPEN or APPEND commands to be ignored,
- X resulting in all output going to the screen. This is useful for
- X seeing the output from a script that normally goes to a disk file.
- X
- X -t
- X This option enables trace mode, which is useful for debugging large
- X scripts. Before each command in the script is executed, it is
- X printed to the screen. See the discussion of the TRACE command for
- X more information on the output produced, and its usefulness.
- X
- X An alternative method of running BBSindex is provided, to make it
- X possible to setup a menu option within BBS-PC! which will invoke
- X BBSindex automatically. This can be done using menu function 111
- X (Run External Program). However, BBS-PC! doesn't allow parameters to be
- X passed to programs started in this manner. To get around this, BBSindex
- X can be renamed to BBscript. When it is run as BBscript, it ignores any
- X command line parameters and instead looks for a script file called
- X BBSindex.scr in the current directory. This is particularly useful if
- X you are running the system remotely, and don't have easy access to the
- X local keyboard.
- X
- X There are a few things to look out for. You should run BBSindex in the
- X same directory as BBS-PC!'s CFGINFO.DAT and UDHEAD.DAT files (unless you
- X override these defaults with -c and -d, or via the appropriate script
- X commands). In addition, if you want BBSindex to know which files are
- X online and valid, you need to give the CHECKFILES command in the script.
- X This deliberate step is needed because checking all the files can take
- X some time on a large system, and is not always required. You should also
- X ensure that your CLI stack size is set to around 10000 or so. If
- X BBSindex runs out of stack, it will tell you so; restart it with a
- X larger stack.
- X
- X BBSindex needs a lot of memory to run -- around 300K altogether when
- X processing a 200K database. This is because the entire database file is
- X kept in memory while processing. Of course, people with a 200K file
- X database are likely to have extra memory as well, so this shouldn't be
- X a huge problem, though it may prevent you from running BBSindex from
- X within BBS-PC!. In any case, BBSindex doesn't crash when it runs out
- X of memory, it prints an error message, frees up all its resources and
- X exits cleanly. It does likewise if you press CTRL-C, which can be used
- X to abort at almost any time. (Sorting can't be interrupted, because the
- X overhead of checking for CTRL-C would make it significantly slower.
- X Sorts are pretty quick anyway, since they are done completely in memory).
- X
- X By now, you're probably wondering what actually goes into the script
- X file that BBSindex interprets. The next section describes this in
- X detail. You can also look at the example script files which accompany
- X BBSindex for a few ideas. Try running them with the -s option to make
- X them send output to the screen.
- X
- X
- XSCRIPT FILES
- X
- X A script file is simply a standard text file which contains a list
- X of BBSindex commands to be executed. It is similar to a standard
- X AmigaDOS batch file, though quite a bit more flexible in its layout.
- X
- X You normally put one command on each line (blank lines are fine of
- X course), but you can have multiple commands on a single line if you
- X seperate them with a semicolon (`;'). Commands are case insensitive
- X (everything is converted to uppercase internally). You can build up
- X extra long command lines by ending each physical line with `\'. The
- X following newline will then be ignored, and the command continued
- X on the next line. Anything after a `#' to the end of a line is
- X treated as a comment.
- X
- X Many commands take parameters. Multiple parameters are seperated
- X by commas or spaces. If you want to include spaces or lowercase
- X characters in a parameter (usually the case), you need to surround it
- X with quotes. You can use either single or double quotes; if you use
- X single quotes, the string inside can contain double quotes and vice
- X versa.
- X
- X BBSindex allows you to define constants, which can then be used later
- X on as part of a command. It can be useful to assign items subject to
- X change (such as output filenames) to constants at the start of the
- X script file, and to use these constants throughout the rest of the file.
- X Changing a filename then becomes a simple matter of altering the
- X constant definition, rather than having to hunt through the script file.
- X
- X You define a constant by saying
- X
- X name = value
- X
- X where name is any identifier up to 20 characters, and value is a
- X single string. If value is surrounded by quotes, they are stripped off,
- X but the case of the text inside is retained. To use the constant, you
- X just say $(name) anywhere in a command, even within quotes. Any `$'
- X character which isn't immediately followed by an open parenthesis is
- X left unchanged.
- X
- X For example, you might say at the start of a script
- X
- X Filename = "Sys:BBS/Amiga.Files"
- X
- X and then later on, you could use it to open a file:
- X
- X OPEN $(Filename)
- X
- X As with everything else, constant names are case insensitive.
- X
- X
- XSCRIPT COMMANDS
- X
- X This section contains a list of the commands recognised by BBSindex. If
- X you make an error in a script, you'll get an error message listing the
- X name of the script file, the line the error occurred on, and a brief
- X explanatory message.
- X
- X To start with, here's a brief synopsis of all the commands. Below this,
- X each command is described in detail.
- X
- X Command Name Description
- X ~~~~~~~~~~~~ ~~~~~~~~~~~
- X APPEND "name" Append future output to the end of file "name"
- X CHECKFILES Scan BBS-PC!'s file directories
- X CLOSE Close current output file, reverting to screen
- X CONFIG "name" Specify full pathname to access the CFGINFO.DAT file
- X DATABASE "name" Specify full pathname to access the UDHEAD.DAT file
- X ECHO "string" Output "string" to the current output file
- X EXEC "command" Execute an AmigaDOS command
- X FOREIGN List all the files not in BBS-PC's file catalogue
- X FORMAT "string" Specify the format to print file listings in
- X IGNORE file ... Specify files to ignore when doing CHECKFILES
- X LIST List all the files matching the SELECT criteria
- X MACRO name/ENDM Define a new macro called name
- X MSG "string" Display "string" on the screen
- X NOREQUEST Stop AmigaDOS putting up error requesters
- X OPEN "name" Direct future output to file "name"
- X RESET Reset the file counters used by SCAN and LIST
- X SCAN Update counters as LIST, but don't print any output
- X SELECT criteria Specify criteria to use when listing files
- X SORT index ... Sort database under the specified fields
- X TRACE [ON | OFF] Turn on or off trace mode
- X
- X
- XAPPEND Filename
- X
- X Opens an existing file as the current output file. Any output from
- X BBSindex will be appended to the end of this file, until it is closed.
- X When no file is open, output goes to the screen. If a file is already
- X open when this command is given, then it will be closed before the
- X new file is opened.
- X
- X
- XCHECKFILES [dir1, dir2, ...]
- X
- X Causes the BBS-PC! file directories on the local disk to be scanned,
- X so that it can determine which files are online and which are not. It
- X also compares the size of each file in the catalogue with its size on
- X disk, and if the two are different, sets the invalid flag for that file.
- X This is a reasonable indication that the file may be corrupt.
- X
- X CHECKFILES need only be done if you want to use the %f, %i, %p or %v
- X options of FORMAT, or you want to use the FOREIGN command. A single
- X CHECKFILES checks all the files, so it need only be done once. Future
- X occurances of CHECKFILES are ignored.
- X
- X By default, BBSindex looks in the CFGINFO.DAT file to find out the
- X location of the BBS-PC! file directories. CFGINFO.DAT should be in the
- X current directory, unless the -c option has been given to specify a
- X different location for it.
- X
- X If you give a list of directories to CHECKFILES, then these directories
- X are scanned instead of those in CFGINFO.DAT, and the latter doesn't
- X need to be accessed.
- X
- X
- XCLOSE
- X
- X Closes the current file (if any) for output. Any future output gets
- X sent to the screen. It is not necessary to specifically close files
- X when you are finished with them (unless you really do want the output
- X to start being displayed on the screen) since BBSindex will close
- X files automatically when it exits.
- X
- X
- XCONFIG "filename"
- X
- X Tells BBSindex where to find the BBS-PC! configuration file, which
- X contains the directory paths for the upload/download file directories.
- X This file is only accessed if you give a CHECKFILES command and don't
- X specify any directories; if you don't intend doing a CHECKFILES, you
- X don't need to worry about BBSindex being able to find the configuration
- X file. By default, BBSindex looks for the file CFGINFO.DAT in the
- X current directory.
- X
- X Be careful to specify the full filename of the configuration file,
- X not just the directory name.
- X
- X
- XDATABASE "filename"
- X
- X Tells BBSindex where to find the BBS-PC! file database. The commands
- X CHECKFILES, SORT, LIST and SCAN will all cause the file database to be
- X read in. The DATABASE command can be given at any stage before this.
- X Afterwards, it has no effect. If you don't give a DATABASE command,
- X then the file UDHEAD.DAT in the current directory is used.
- X
- X
- XECHO "string" [NOLINE]
- X
- X Outputs "string" to the current file, or if no output file is open, to
- X the screen. "string" can contain any of the escape characters (such
- X as `\n') listed under FORMAT. It can also contain any of the following
- X special symbols:
- X
- X %b The number of bytes used by files printed by the last LIST
- X %k The number of Kilobytes used by files printed by last LIST
- X %m The number of Megabytes used by files printed by last LIST
- X %n The number of files printed by the last LIST command
- X %d Today's day (Monday for example)
- X %t Today's time
- X %ux Creates underline, see FORMAT for more details
- X %w Today's date (01-Jan-90 for example)
- X %{...} Formats substring, see FORMAT for more details
- X
- X %B, %K, %M and %N are also available; these are similar to %b, %k,
- X %m and %n, but they are the sums for all the files printed since the
- X last RESET command, rather than the last LIST command. This allows you
- X to keep a running count of the total number of files printed in the
- X system.
- X
- X By default, a newline is automatically output after the string. This
- X can be suppressed by including the NOLINE parameter.
- X
- X
- XEXEC "command"
- X
- X Executes the specified AmigaDOS command. The output from the command is
- X directed into the current output file. If you don't want this to happen,
- X you can specify redirection to NIL: as part of the command string. For
- X example
- X
- X EXEC "makedir >nil: ram:t"
- X
- X will try and make a directory in RAM:, and if it fails, you won't see
- X anything. The EXEC command can be particularly useful if you've just
- X used the FORMAT command in conjunction with LIST to generate an AmigaDOS
- X script file -- you can then do
- X
- X EXEC "Execute Scriptfile"
- X
- X and the script file will be executed on the spot. If you do this,
- X remember to close the script file you've just generated before you try
- X to execute it.
- X
- X
- XFOREIGN
- X
- X Outputs a list of all the files which are present in BBS-PC!'s download
- X directories, but are not present in the file catalogue. The output is as
- X specified using FORMAT, but only some of the options are applicable. In
- X particular, the following are valid:
- X
- X %d Disk filename
- X %c Descriptive text saying what directory the file is in
- X %f Full disk filename
- X %n The disk filename again
- X %p Disk pathname
- X %x File size in bytes
- X %k File size in K
- X %w Date file was last modified
- X
- X These have been chosen so that the default output format will list the
- X files in a sensible fashion.
- X
- X This command can be useful if you want to track down all files which
- X are not directly related to the bulletin board. For example, the
- X following script generates an AmigaDOS script to move all the non-BBS
- X files into a common directory called Random on DH1:
- X
- X #
- X # Script to move all files not related to the BBS-PC! file
- X # catalogue out of the download directories.
- X #
- X CHECKFILES # Check all files
- X ECHO ";\n; AmigaDOS script to cleanup BBS file directories\n;"
- X FORMAT "copy %f to dh1:random\ndelete %f\n"
- X OPEN ram:execute.script
- X FOREIGN
- X CLOSE
- X
- X When you run this, the output is a script in RAM: which you can then
- X execute using the AmigaDOS Execute command. Alternatively, you could
- X add the command EXEC "Execute RAM:execute.script" to the end of the
- X above script, and then the script itself would move the files.
- X
- X
- XFORMAT "string" [NOLINE]
- X
- X Determines the format of each line printed by the LIST command. The
- X format string is very similar to that used by C's printf() function. It
- X contains normal characters, plus any of the following special symbols:
- X
- X %a Number of times file has been accessed
- X %b{} File type {Binary,Text}
- X %c Comment associated with file
- X %d Filename the file is stored under on disk
- X %f Full pathname of the disk copy of the file
- X %i{} File status {Online,Offline}
- X %k File size in K
- X %l{} File origin {Local,Remote}
- X %n Filename as it appears in the file database
- X %o Uploader's name (owner)
- X %p Path of the directory containing the file on disk
- X %r Directory number
- X %s Section name
- X %ux Produce underline using x as underline char
- X %v{} File contents {Valid,Invalid}
- X %w Upload date (when)
- X %x File size
- X %y Number of the disk directory the file is stored in
- X %{...} Format substring
- X
- X A number may optionally be placed between `%' and the appropriate
- X character. This will cause the output value of the symbol to be padded
- X or truncated to that width. By default, the output is aligned to the
- X left but if the number is prefixed with `-', output is aligned to the
- X right.
- X
- X Symbols followed by {} are boolean values, which can be either TRUE or
- X FALSE. When such a symbol appears in the format string, it should be
- X immediately followed by two substrings enclosed in { and } and separated
- X by a comma. If its value is TRUE, then the first substring is used; else,
- X the second substring is used. For example, if you want to make a list of
- X files, and say whether each one is valid or invalid, you might use:
- X
- X "%20n%v{,(Invalid)}"
- X
- X which would print each filename, and if it was invalid, would follow it
- X with the string "(Invalid)", starting in Column 20. If the file was
- X valid, only the filename would be printed.
- X
- X A special option is `%{', which allows you to format a substring within
- X the main string. This can be of value if you want to have several items,
- X one after the other with no gaps between each, but with the total width
- X of all the items not exceeding a set width. What occurs inside the
- X braces after `%' can be any valid format string, which could itself
- X contain `%{}'s (though it's hard to think of a situation where you would
- X need to do this). So, "%40{%s,%r,%o}" would print the section, directory
- X number and owner name one after the other, with the total being padded
- X or truncated to 40 characters.
- X
- X The other unusual option is `%u', which reproduces the character
- X following it a number of times equal to the length of the last string
- X output using FORMAT. If `%{...}' has just been used, then the length of
- X the substring is used instead. This is handy if you want to underline
- X something but are not sure how long it is (or you just want to save some
- X typing). For example, to underline a filename, you could use:
- X
- X FORMAT "%{%n}\n%u-"
- X
- X This outputs the filename as a substring (thus remembering the length),
- X and a newline, and then underlines the filename using ------. When using
- X `%u', the "length" number that can appear between the `%' and the format
- X character has a slightly different meaning. `%6u' outputs an extra 6
- X underline characters, and `%-6u' outputs 6 fewer characters.
- X
- X The `%i' and `%v' options only make sense if the CHECKFILES command has
- X been given earlier. They indicate whether or not the file is online and
- X whether it is valid. A file is online if it can be found in any of
- X BBS-PC!'s file directories. It is valid if its filesize on disk matches
- X its filesize in the file catalogue. If it doesn't, then there is a good
- X chance it has been corrupted.
- X
- X The `%y' option gives the number of the disk directory in which the
- X file is stored. This is the position of the disk directory as it
- X appears in BBS-PC!'s CFGINFO.DAT file. In particular, the "new uploads"
- X directory is numbered 0. (Note that this is different to the directory 0
- X in which all uploads are located within BBS-PC!).
- X
- X The following escape sequences can also appear in the format string:
- X
- X \n End of line
- X \e Escape
- X \E CSI (0x9b)
- X \t Tab
- X \nnn Octal number with the appropriate value
- X
- X Any other characters after a `\' are treated as normal. This can be used
- X to escape certain characters that have special meaning, such as `\'
- X itself and `%'. `\{' and `\}' do not work within `{...}' (for boolean
- X values and substrings) unfortunately. If you are giving the format
- X string from the command line and you are using a DOS shell other than
- X the CLI, you might need to type `\\' in order to get the shell to pass a
- X single `\' to BBSindex. Note that while `\E' can be useful for
- X generating ANSI colour codes (as in `\E33m' to change the colour to
- X colour 3 for example), BBS-PC! does not recognise `\E', even though
- X AmigaDOS does. Hence, for public BBS files, you are better off using
- X `\e[33m' which gives the same effect. For more details on ANSI escape
- X sequences, see the BBS-PC! or AmigaDOS manuals.
- X
- X By default, a newline is automatically added to the format string. This
- X can be overridden by including the NOLINE parameter after the string.
- X
- X The default output format string is
- X
- X FORMAT "%15n %w %-6x-%b{B,T} %c"
- X
- X This produces a file listing which is identical to the listing BBS-PC!
- X gives when you ask for a file catalogue.
- X
- X
- XIGNORE Filename Filename ...
- X
- X Specifies a list of files to ignore when CHECKFILES is executed. If you
- X have some files in the file catalogue which are updated by external
- X programs, their filesizes are likely to differ from the filesizes
- X recorded in the BBS-PC! file catalogue. By listing such files here, you
- X can tell CHECKFILES that it is okay for the filesizes to be different
- X and they will then be marked as valid (and hence won't appear in any
- X operations you do on invalid files).
- X
- X You can use multiple IGNORE commands if you have a lot of files falling
- X into this category; however, only IGNORE commands which occur before
- X CHECKFILES have any effect.
- X
- X
- XLIST
- X
- X Scans through the the file catalogue (as sorted using SORT) and outputs
- X the list of files which match the criteria specified with SELECT,
- X according to the format string defined using FORMAT. Output is sent to
- X the current file (opened with OPEN) or if none exists, to the screen.
- X
- X In addition, some internal counters are updated. These counters record
- X the number of files listed and the total number of bytes occupied by
- X those files. A seperate set of counters record the total number of files
- X listed since the start of the script (or the last RESET command). This
- X is useful for building cumulative totals. See the ECHO command for more
- X details.
- X
- X
- XMACRO name
- X command 1
- X command 2
- X ...
- XENDM
- X
- X Defines a macro command. When this command is used later on, it gets
- X replaced by the list of commands between the MACRO and ENDM markers.
- X The macro text can contain the special symbols $1 to $9 which will
- X expand to the parameters given to the command. For example, a macro to
- X sort and list the files in a specified directory in a given section
- X might look like this:
- X
- X MACRO Listdir # Section, Directory, Descriptive Text
- X MSG "$2, " noline
- X ECHO "%{$2. $3}\n%u-" # Display header, and underline it
- X SELECT Section = $1 AND Directory = $2
- X LIST
- X ENDM
- X
- X To use this, you would then give a command like:
- X
- X Listdir 1, 4, "General Files"
- X
- X to list the files in Directory 4 of Section 1. Note that the comma is
- X optional (it gets turned into a space internally anyway) but can make
- X things more readable. Also note that any text surrounded by quotes has
- X the quotes removed (but the text case retained) when it is substituted.
- X This is to allow $ substitution to occur within strings in the macro
- X without getting lots of extra quotes everywhere. If you need to get a $
- X itself inside the macro, you can use `$$'. In fact, `$' followed by any
- X non-numeric character will simply return that character.
- X
- X Macros are a very powerful feature; used sensibly, they can reduce the
- X size of your script files by a significant amount, allowing you to
- X express a complicated sequence of commands in only a single line. If you
- X have many command sequences which are very similar, it is well worth
- X taking the time to learn to use macros effectively.
- X
- X
- XMSG "string" [NOLINE]
- X
- X Outputs "string" just like the ECHO command, except that the string
- X always goes to the screen, even when an output file is open. This
- X provides a useful way to print informative messages saying what is
- X happening, while processing a big script.
- X
- X
- XNOREQUEST
- X
- X Stops AmigaDOS from putting up requesters when it can't find a disk
- X volume, or when a disk error occurs. This can be useful if you are
- X running BBSindex in a batch environment, where you most likely won't be
- X around to click Retry or Cancel in the requester. It is also useful if
- X you are running BBSindex remotely (from within BBS-PC! as a menu option).
- X
- X
- XOPEN Filename
- X
- X Opens a new file for output. Any output from BBSindex will be directed
- X to this file until it is closed. When no file is open, output goes to
- X the screen. If a file is already open when this command is given, then
- X it will be closed before the new file is opened.
- X
- X
- XRESET
- X
- X Resets the counters used by the %B, %K, %M and %N options of the ECHO
- X command. See the descriptions of SCAN and ECHO for more details.
- X
- X
- XSCAN
- X
- X Scans the file database, counting files that match the SELECT criteria
- X just like LIST. Unlike LIST, it doesn't produce any output. It does
- X however update the counters which keep track of the number of files
- X printed. This is very useful if you want to produce a file listing which
- X displays the number of files in the system at the start of the file,
- X followed by the files themselves. You can do that as follows:
- X
- X SCAN
- X ECHO "Amiga BBS File Catalogue, a total of %n files are online\n\n"
- X LIST
- X
- X SCAN counts the files so that %n will be the correct number in the ECHO
- X command, and then LIST actually lists them. Of course, if you wanted to
- X print the number of files at the bottom of the list, the LIST command
- X by itself would be adequate, and you would not need to use SCAN.
- X
- X
- XSELECT expression
- X
- X Selects which files should be printed on the screen when the LIST
- X command is given. The expression you give can include any of the
- X keywords recognised by the SORT command, plus the boolean operators
- X AND, OR and NOT, and the special keyword ALL (which is always true). In
- X addition, the keywords Text, Remote, Offline and Invalid are recognised
- X as opposites to Binary, Local, Online and Valid.
- X
- X The following arithmetic operators are supported:
- X
- X = <> > < >= <=
- X
- X These can be combined together with strings and numbers and grouped
- X with parenthesis to produce a full expression. During LIST, any files
- X which match the expression are listed. For example, to select all the
- X binary files in Section 3, and Directories 4-10, you could use
- X
- X SELECT Section = 3 AND Directory >= 4 AND Directory <= 10 AND Binary
- X
- X Note that the eight boolean fields (Binary, Text, Online, Offline,
- X Local, Remote, Valid and Invalid) don't need to be tested against
- X anything, since they already evaulate to a boolean result. For example,
- X Local will evaluate to TRUE if the file being checked was uploaded
- X locally.
- X
- X For date comparisons, recent dates are treated as being "larger"
- X than older dates. For example, to list all files uploaded during
- X December of 1989, you could say
- X
- X SELECT Date >= "01-Dec-89" AND Date <= "31-Dec-89"
- X
- X String comparisons are case insensitive, and standard wildcards are
- X supported. A `?' in a string will match any single character, and a `*'
- X will match any number of characters (including none). For example
- X
- X SELECT Name = "*.ZOO" AND Section = 3
- X
- X selects all the zoo files in section 3. The pattern "?????" would match
- X all names five characters long. If you wanted to select all the files
- X which were archived using a common file archiver, you might use:
- X
- X SELECT Name = "*.ZOO" OR Name = "*.ARC" OR Name = "*.LZH"
- X
- X If you want to use <, >, <= and >= with wildcard matching, you need to
- X be careful. Bear in mind that < and > exclude exact matches, whereas
- X <= and >= include exact matches. As an example, let's see use a file
- X called "FOO". The comparison "FOO" < "F*" is not particularly well
- X defined, but will probably be FALSE. On the other hand, "FOO" <= "F*"
- X will always evaluate to true, since the `=' portion is true.
- X
- X Let's finish off with some more examples of selections. To select all
- X the text files in section 3, you could use:
- X
- X SELECT Section = F and Text
- X
- X Now, let's select all the binary files in section 3, and also all the
- X text files in section 3 that end with .ZOO or .ARC (such a requirement
- X might come about because some versions of BBS-PC! have a bug which
- X makes ZMODEM uploads look like Text files):
- X
- X SELECT Section = 3 and (Binary or Name = "*.ZOO" or Name = "*.ARC")
- X
- X As a final note, be aware that the more complicated the expression, the
- X longer it will take to do a LIST (or SCAN). You can help speed things
- X up by arranging that the condition most likely to be FALSE is at the
- X front of the expression. For example, use
- X
- X SELECT Size > 102400 and Name <> *.ZOO
- X
- X when selecting all non-ZOO files in the system greater than 100K, rather
- X than the other way around.
- X
- X
- XSORT index [, index, index ...]
- X
- X Sorts the file list into an order determined by the list of indices
- X given. When output is being generated, it is sorted according to the
- X indices specified here. The following indices are valid:
- X
- X Access Number of times a file has been accessed (number)
- X Binary Whether the file is binary or text (boolean)
- X Comment File comment (string)
- X Date Upload date (date)
- X Directory Directory number (number)
- X DiskDirNum Number of the file directory on disk (number)
- X DiskName Name of the file on disk (string)
- X KSize File size in K (number)
- X Local Whether the file was uploaded locally (boolean)
- X Name File catalogue name (String)
- X Online Whether the file is online (boolean)
- X Owner Uploader's name (String)
- X Pathname Pathname of disk file (String)
- X Section Section number (number)
- X Size File size in bytes (number)
- X Valid Whether the filesize is valid (boolean)
- X
- X Each index can optionally by followed by a `+' or `-', to indicate the
- X direction of sorting. The default (+) is to sort in ascending order.
- X Descending order is selected using `-'. As many indices as are listed
- X are considered significant while sorting.
- X
- X The default sorting order is Name which sorts files by name. An
- X alternative index might be Section, Directory, Name which would sort
- X the files into seperate sections, then into seperate directories within
- X each section, and finally into alphabetical order within each directory.
- X
- X You can sort files into chronological order by using Date as the sort
- X key, or into reverse chronological order (i.e. newest files first) by
- X using Date- as the key.
- X
- X Note that the CHECKFILES command sorts the database into alphabetical
- X order by disk name before it starts scanning the disk. If you have given
- X a SORT command before this, then CHECKFILES will sort the files a second
- X time back into the order you specified. You can avoid the time overhead
- X this involves (which is not actually that much) by not using SORT until
- X after CHECKFILES.
- X
- X
- XTRACE [ON | OFF]
- X
- X Turns on or off trace mode. When tracing is turned on, all the commands
- X thereafter will be output to the screen before they are executed. This
- X can be useful for tracking down a problem with a script. In particular,
- X the commands which make up a macro will be printed individually each
- X time the macro is executed, with $1 to $9 replaced by the actual
- X parameters. Constants will also be replaced by their current value.
- X Tracing can be turned on globally by specifying the -t option on the
- X command line; TRACE ON and TRACE OFF are most useful when you have a
- X large script file and you don't want to have to trace through all of it.
- X
- X
- XHISTORY
- X
- X V0.99 Initial beta release. Several bugs, and a few inconsistencies.
- X
- X - Vigilant beta testers proved that nothing works first time :-)
- X - Kudos to Lattice's catch.o for making life a bit more bearable
- X (and also to CodeProbe of course).
- X
- X V1.0 First official release.
- X
- X - Improved memory allocator to handle small requests by
- X allocating a large chunk and working from that. This should
- X help decrease memory fragmentation.
- X - Added support for constants
- X - Added IGNORE keyword to allow "dynamic" files to avoid being
- X marked as invalid.
- X - Reworked the documentation a bit, so that it wasn't quite as
- X disorganised.
- X - Toyed with the idea of allowing scripts to be specified on
- X the command line (like sed) but decided wasn't worth the
- X effort for now.
- X
- X
- XDISTRIBUTION
- X
- X BBSindex may be freely distributed for non-commercial purposes, as long
- X as no profit is made from doing so. It may be distributed with
- X commercial software only with the express written agreement of the
- X author. Specific permission is granted to Fred Fish to include BBSindex
- X in his fine public domain library.
- X
- X
- XAUTHOR
- X
- X Please direct any praise, criticism, general suggestions or
- X large sums of money to:
- X
- X Eddy Carroll
- X ecarroll@vax1.tcd.ie (Trinity College, Dublin, Ireland)
- X
- X Also, please feel welcome to pay a visit to Infomatique BBS, of
- X which I am a co-sysop:
- X
- X Phone: +353-1-302970 (Ireland)
- X Speeds: V21/22bis/23
- X Times: 24 hours/day
- X
- X 110 Megs of online storage, large Amiga and IBM file database.
- X Membership is free. If you call, mention where you got the number.
- END_OF_FILE
- if test 36686 -ne `wc -c <'bbsindex.doc'`; then
- echo shar: \"'bbsindex.doc'\" unpacked with wrong size!
- fi
- # end of 'bbsindex.doc'
- fi
- echo shar: End of archive 3 \(of 3\).
- cp /dev/null ark3isdone
- MISSING=""
- for I in 1 2 3 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 3 archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- --
- Submissions to comp.sources.amiga and comp.binaries.amiga should be sent to:
- amiga@cs.odu.edu
- or amiga@xanth.cs.odu.edu ( obsolescent mailers may need this address )
- or ...!uunet!xanth!amiga ( very obsolescent mailers need this address )
-
- Comments, questions, and suggestions s should be addressed to ``amiga-request''
- (only use ``amiga'' for submissions) at the above addresses.
-